package db_main

import (
	"fmt"
	"longmen/server/config/global"
	"longmen/server/pkg/common/helper/util"
	"longmen/server/pkg/db/mysql/models/models_main"

	"longmen/server/pkg/common/api_models"
)

func InsertFeedback(uId int, req *api_models.UserFeedbackReq) error {
	fName := "InsertFeedback"
	m := &models_main.UserFeedback{
		Uid:     int64(uId),
		Title:   req.Title,
		Content: req.Content,
	}

	err := global.GetX().Create(m).Error
	if err != nil {
		return fmt.Errorf("%s%s", util.Convert(fName), err.Error())
	}
	return nil
}
